"use strict";
cc._RF.push(module, 'bc7410ecy5LuYMKoEUxe1NN', 'ArrayUtil');
// script/standar/utils/ArrayUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LogUtil_1 = require("./LogUtil");
/**
 * ArrayUtil:数组操作相关接口
 * @author ituuz
 */
var ArrayUtil = /** @class */ (function () {
    function ArrayUtil() {
    }
    ArrayUtil.stringify = function (src) {
        var str = "";
        for (var _i = 0, src_1 = src; _i < src_1.length; _i++) {
            var s = src_1[_i];
            str = str + " " + ArrayUtil.toString(s);
        }
        return str;
    };
    ArrayUtil.toString = function (s) {
        if (s == null) {
            return "null";
        }
        else if (s === undefined) {
            return "undefined";
            // tslint:disable-next-line: use-isnan
        }
        else if (s === NaN) {
            return "NaN";
        }
        else {
            return s.toString();
        }
    };
    /**
     * clone数组
     * @param list 目标数组，基本类型可以直接clone，对象类型需要对象有clone接口；
     */
    ArrayUtil.clone = function (list) {
        var newList = new Array();
        for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
            var o = list_1[_i];
            var temp = void 0;
            if (typeof o === "object") {
                temp = o.clone();
            }
            else {
                temp = o;
            }
            newList.push(o);
        }
        return newList;
    };
    /**
     * 数组内容相加, 并返回一个新数组
     * @param list1
     * @param list2
     */
    ArrayUtil.listAddList = function (list1, list2) {
        var newList = [];
        if (list1.length !== list2.length) {
            LogUtil_1.default.warn("两个数组长度不同，不能相加。");
            return null;
        }
        for (var i = 0; i < list1.length; i++) {
            var newValue = list1[i] + list2[i];
            newList.push(newValue);
        }
        return newList;
    };
    return ArrayUtil;
}());
exports.default = ArrayUtil;

cc._RF.pop();